<template>
	<el-main>
		<el-row :gutter="15">
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option"></scEcharts>
				</el-card>
			</el-col>
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option2"></scEcharts>
				</el-card>
			</el-col>
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option3"></scEcharts>
				</el-card>
			</el-col>
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option4"></scEcharts>
				</el-card>
			</el-col>
		</el-row>
	</el-main>
</template>

<script>
import scEcharts from '@/components/scEcharts';
export default {
	name: 'chart',
	components: {
		scEcharts
	},
	data() {
		return {
			option: {},
			option2: {},
			option3: {},
			option4: {}
		}
	},
	mounted() {
		this.getBiCustomerIndustryPie();
		this.getBiCustomerSourcePie();
		this.getBiCustomerKeepUserPie();
		this.getBiCustomerLevelPie();
	},
	methods:{
		async getBiCustomerIndustryPie(){
			var res = await this.$API.crm.echarts.getBiCustomerIndustryPie.get();
			if (res.code == 200) {
				this.option = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getBiCustomerSourcePie(){
			var res = await this.$API.crm.echarts.getBiCustomerSourcePie.get();
			if (res.code == 200) {
				this.option2 = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getBiCustomerKeepUserPie(){
			var res = await this.$API.crm.echarts.getBiCustomerKeepUserPie.get();
			if (res.code == 200) {
				this.option3 = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getBiCustomerLevelPie()
		{
			var res = await this.$API.crm.echarts.getBiCustomerLevelPie.get();
			if (res.code == 200) {
				this.option4 = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
	}
}
</script>

<style>
</style>
